package day17_Inet.demo09_TCP;

import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
/*
    void shutdownInput()
    将此套接字的输入流放置在“流的末尾”。
    void shutdownOutput()
    禁用此套接字的输出流。

 */
public class Clien_TCL {
    public static void main(String[] args) throws Exception{
        Socket socket = new Socket("127.0.0.1", 8888);
        //发送
        OutputStream os = socket.getOutputStream();
        os.write("abcdefg".getBytes());
        socket.shutdownOutput();
        //接收
        InputStream is = socket.getInputStream();
        byte[] bytes = new byte[1024];
        int i = is.read(bytes);
        System.out.println(new String(bytes,0,i));
        socket.close();


    }
}
